<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>data Stream file template</title>
    <link href="<%=staticRelativePath%>/normalize.css" rel="stylesheet" type="text/css" />
</head>
<style type="text/css">
table{
    width: 100%;
}
table, th, td {
    border: 1px solid black;
    text-align: center;
}
th,span {
      font-weight: bold;
    }
td{
      font-weight: normal;
    }
.table-margin-top {
      margin-top: 20px;
    }
.td-context-left {
    text-align:left;
}
</style>
<body>
    <div>
      <div><h1><%= reportName %></h1></div>
      <div style="text-align: right;"><span>日期：<%=reportTime%>&nbsp;&nbsp;</span></div>
        <div>
          <table>
            <tbody>
                <tr>
                  <td>项目名称</td>
                  <td><%= projectName%></td>
                </tr>
                <tr>
                  <td>版本号</td>
                  <td><%= versionName%></td>
                </tr>
            </tbody>
          </table>
        </div>

        <div><h2>函数调用信息</h2></div>
            <div class="table-margin-top"><h3>函数调用列表</h3></div>
          <div>
                <table>
                    <tbody>
                        <tr>
                            <th>函数</th>
                            <th>文件</th>
                            <th>行号</th>
                            <th>调用函数</th>
                            <th>调用函数所属文件</th>
                            <th>调用行号</th>
                        </tr>
                        <% for(let i = 0; i < files.length; i +=1) {
                          const file = files[i];%>
                        <% for (let j = 0; j < file.functions.length; j +=1) { 
                            const func = file.functions[j];
                            const callingOtherFunctions = func.callingOtherFunctions; %>
                            <% for (let k = 0; k < callingOtherFunctions.length; k += 1 ) {
                                const callingFunc = callingOtherFunctions[k]; %>
                                <tr>
                                    <td><%= func.functionName %></td>
                                    <td><%= file.filePath %></td>
                                    <td><%= func.line %></td>
                                    <td><%= callingFunc.name %></td>
                                    <td><%= callingFunc.filePath %></td>
                                    <td><%= callingFunc.lines %></td>
                                </tr>
                            <%}%>
                          <%}%>
                        <%}%>
                    </tbody>
                </table>
            </div> 
            <div class="table-margin-top"><h3>函数被调用列表</h3></div>
            <div>
                <table>
                    <tbody>
                        <tr>
                            <th>函数</th>
                            <th>文件</th>
                            <th>行号</th>
                            <th>被调用函数</th>
                            <th>被调用函数所属文件</th>
                            <th>被调用行号</th>
                        </tr>
                        <% for(let i = 0; i < files.length; i +=1) {
                          const file = files[i];%>
                        <% for (let j = 0; j < file.functions.length; j +=1) { 
                            const func = file.functions[j];
                            const calledByOtherFunctions = func.calledByOtherFunctions; %>
                            <% for (let k = 0; k < calledByOtherFunctions.length; k += 1 ) {
                                const calledByOtherFunc = calledByOtherFunctions[k]; %>
                                <tr>
                                    <td><%= func.functionName %></td>
                                    <td><%= file.filePath %></td>
                                    <td><%= func.line %></td>
                                    <td><%= calledByOtherFunc.name %></td>
                                    <td><%= calledByOtherFunc.filePath %></td>
                                    <td><%= calledByOtherFunc.lines %></td>
                                </tr>
                            <%}%>
                          <%}%>
                        <%}%>
                    </tbody>
                </table>
            </div>
        <h2>变量分析</h2>
        <div>
            <table>
                <tbody>
                    <tr>
                        <th>变量</th>
                        <th>所属文件</th>
                        <th>变量种类</th>
                        <th>变量类型</th>
                        <th>变量作用</th>
                        <th>位置</th>
                    </tr>
                    <% for (let j = 0 ; j < files.length; j += 1) {
                       const file = files[j]; %>
                       <% for (let i = 0; i < file.variables.length; i += 1) {
                       const item = file.variables[i]; %>
                       <%if (item.categoryKind === 'G') {%>
                        <tr>
                         <td><%= item.name %></td>
                         <td><%= file.filePath %></td>
                         <td><%= item.categoryName %></td>
                         <td><%= item.type %></td>
                         <td><%= item.scope %></td>
                         <td><%= item.locations %></td>
                       </tr>
                       <%}%>
                     <%}%>
                    <%}%>
                </tbody>
            </table>
        </div>

    </div>
</body>

</html>
